package cn.maxhou.sl2.config;

import cn.maxhou.sl1.entity.SysRole;
import cn.maxhou.sl1.entity.SysUser;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;

//定义配置类
public class JavaConfig3 {

    @Bean
    public SysUser user(@Qualifier("managerRole")SysRole role){
        SysUser user = new SysUser();
        user.setRealName("张三");
        user.setAccount("zhangsan");
        user.setPassword("123456");
        user.setSex(1);
        //返回对象会被注册道Spring容器中

        user.setRole(role);

        return user;
    }
}
